/**
 * @Date 2023-02-21 10:03:49
 * @Remark
 */

// react
import React from "react";
// lib
import { Button, Space, Tooltip } from "antd";
import { state } from "./state";
// import { getReissueGoodsPage } from "./controller";
// store
// controller

const TableColumns = [
  {
    title: "配送单号",
    dataIndex: "id",
  },
  {
    title: "关联订单号",
    dataIndex: "orderSn",
  },
  {
    title: "所属店铺",
    dataIndex: "shopName",
  },
  {
    title: "配送人",
    dataIndex: "deliveryUserName",
  },
  {
    title: "配送人电话",
    dataIndex: "deliveryUserMobile",
  },
  {
    title: "收货人",
    dataIndex: "consigneeName",
  },
  {
    title: "收货人电话",
    dataIndex: "consigneeMobile",
  },
  {
    title: "收货人地址",
    dataIndex: "consigneeAddress",
  },
  {
    title: "预约时间",
    dataIndex: "replenishmentTime",
  },
  {
    title: "送达时间",
    dataIndex: "receiveTime",
  },
  {
    title: "异常原因",
    dataIndex: "abnormalCause",
    width: 300,
    render: (abnormalCause: string) => (
      <Tooltip placement="topLeft" title={abnormalCause}>
        <div
          style={{
            width: 280,
            overflow: "hidden",
            textOverflow: "ellipsis",
            whiteSpace: "nowrap",
          }}
        >
          {abnormalCause}
        </div>
      </Tooltip>
    ),
  },
  {
    title: "操作",
    key: "action",
    fixed: "right" as any,
    render: (el: any) => {
      // 详情
      const detail = async () => {
        state.editModal = el;
        // await getReissueGoodsPage(el.orderId);
      };
      // 异常订单
      const edit = () => {
        state.abnormalOrderEditModal = el;
      };
      return (
        <Space>
          <Button size="small" type="primary" ghost onClick={detail}>
            详情
          </Button>
          <Button size="small" type="primary" ghost>
            已送达
          </Button>
          <Button size="small" type="primary" ghost danger onClick={edit}>
            异常订单
          </Button>
        </Space>
      );
    },
  },
];

export default TableColumns;
